module.exports = function ($scope, $resource,tourgroup_code,flag, $state,$modalInstance, $http, FileUploader, toaster) {
  var tourgroup_code = flag ? {'flag': true} : tourgroup_code;
  console.log(tourgroup_code)
  var para = {}

  $scope.info = [];
  $scope.savedata = {};
  $scope.namedata = {};
  $scope.obj = {
    'guide_code': '',
    'tourgroup_code' :tourgroup_code
  };

  $resource('/api/as/ggc/tourgroupafter/getguideBytCode', {}, {}).save({'tourgroup_code':tourgroup_code},function (res) {
    if (res.errcode !== 0) {
      alert("数据获取失败");
      return;
    }
    $scope.namedata = res.data;
  })
  $resource('/api/as/ggc/tourgroupafter/findGuideList', {}, {}).save(para,function (res) {

    if (res.errcode !== 0) {
      alert("数据获取失败");
      return;
    }
    $scope.info = res.data;
  });

  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };
  $scope.ok = function () {
      // 插入我的表里
      $resource('/api/as/ggc/tourgroupafter/updateGuideCodeByTcode', {}, {}).save($scope.obj,function (res) {
        if (res.errcode !== 0) {
          alert("更新失败");
          return;
        }
        $modalInstance.close();
      });
  };

}